package com.ssy.lingxi.purchase.api.enums.bidding;

import com.ssy.lingxi.common.language.LanguageHolder;

import java.util.Arrays;
/**
 *列表是否显示按钮枚举类
 */
public enum  ButtonEnums {

    ALL(1, "显示全部按钮"),
    UPDATE_QUERY(2, "显示修改查看"),
    SIGNUP(3, "显示报名"),
    RE_SIGNUP(4, "显示重新报名"),
    ;

    private Integer state;
    private String name;

    public Integer getState() {
        return state;
    }

    public void setState(Integer state) {
        this.state = state;
    }

    public String getName() {
        return LanguageHolder.getName(this.getClass(), this.state);
    }

    public void setName(String name) {
        this.name = name;
    }

    ButtonEnums(Integer state, String name) {
        this.state = state;
        this.name = name;
    }

    public static String getName(Integer state){
        ButtonEnums workEnum = Arrays.stream(ButtonEnums.values()).filter(v -> v.getState().equals(state)).findAny().orElse(null);
        return null == workEnum ? "" : LanguageHolder.getName(ButtonEnums.class, workEnum.getState());
    }
}
